package com.wrupple.muba.common.client.activity;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.wrupple.muba.common.domain.DesktopPlace;
import com.wrupple.muba.common.shared.State.DesktopManager;
import com.wrupple.muba.common.shared.State.ProcessManager;
import com.wrupple.muba.common.shared.process.impl.SequentialProcessManager.SetApplicationStateAndContext;

public abstract class AbstractSequentialActivity<T extends ProcessManager> extends AbstractActivity implements DesktopActivity {
	
	protected T webapp;
	
	protected DesktopManager dm;
	
	public AbstractSequentialActivity(T webapp, DesktopManager dm) {
		super();
		this.webapp = webapp;
		this.dm=dm;
	}


	@Override
	public void start(AcceptsOneWidget panel, EventBus eventBus) {
		DesktopPlace place = dm.getWhere();
		String localizedName = place.getProperty(DesktopPlace.LABEL_PARAMETER);
		getActivityProcess(place, new SetApplicationStateAndContext(webapp, panel, eventBus, localizedName));
	}
	

}
